



// This code is a generated code by a tool
// designed and coded by Shohdi Mohamed Elsheemy ( shohdi@gmail.com )            

using System;
using System.Collections.Generic;
using System.Web;
using System.Data.Common;
using Shohdi.DataHandler;
using System.Data;




namespace DatabaseComponent
{
    
    public partial class PersonsRulesViewDB
    {
         string _Connection = "";


        public string Connection
        {
            get { return _Connection; }
            set { _Connection = value; }
        }


       
         string _Provider = "System.Data.SqlClient";

        
        public string Provider
        {
            get { return _Provider; }
            set { _Provider = value; }
        }



        public PersonsRulesViewDB()
        {
        }

        public PersonsRulesViewDB(string __Connection,params string [] __Provider)
        {

            if (__Provider.Length > 0)
                _Provider = __Provider[0];

            _Connection = __Connection;
            
        }




        public List<PersonsRulesView> Select(ClassDataHandler con, string strTop, string strWhere, params DbParameter[] whereParams)
        {
            if (whereParams == null)
                whereParams = new DbParameter[0];

            List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

            string strQuery = " select " + strTop  + " * from dbo.[PersonsRulesView]  " ;

            if (strWhere != "")
            {
                strQuery = strQuery + "  " + strWhere;
            }

            DbDataReader dr = con.SelectDataReader(strQuery, CommandType.Text, whereParams);


            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    PersonsRulesView obj = new PersonsRulesView();
 if (dr["GenID"] != DBNull.Value)
                    {
                        obj.GenID = (System.Int64)dr["GenID"];
                    }
                    else
                    {
                        obj.GenID = -1;
                    } 
 if (dr["Name_AR"] != DBNull.Value)
                    {
                        obj.Name_AR = (System.String)dr["Name_AR"];
                    }
                    else
                    {
                        obj.Name_AR = "";
                    } 
 if (dr["Name_EN"] != DBNull.Value)
                    {
                        obj.Name_EN = (System.String)dr["Name_EN"];
                    }
                    else
                    {
                        obj.Name_EN = "";
                    } 
 if (dr["MiddleName_AR"] != DBNull.Value)
                    {
                        obj.MiddleName_AR = (System.String)dr["MiddleName_AR"];
                    }
                    else
                    {
                        obj.MiddleName_AR = "";
                    } 
 if (dr["MiddleName_EN"] != DBNull.Value)
                    {
                        obj.MiddleName_EN = (System.String)dr["MiddleName_EN"];
                    }
                    else
                    {
                        obj.MiddleName_EN = "";
                    } 
 if (dr["FamilyName_AR"] != DBNull.Value)
                    {
                        obj.FamilyName_AR = (System.String)dr["FamilyName_AR"];
                    }
                    else
                    {
                        obj.FamilyName_AR = "";
                    } 
 if (dr["FamilyName_EN"] != DBNull.Value)
                    {
                        obj.FamilyName_EN = (System.String)dr["FamilyName_EN"];
                    }
                    else
                    {
                        obj.FamilyName_EN = "";
                    } 
 if (dr["Gender"] != DBNull.Value)
                    {
                        obj.Gender = (System.Boolean)dr["Gender"];
                    }
                    else
                    {
                        obj.Gender = false;
                    } 
 if (dr["Badge"] != DBNull.Value)
                    {
                        obj.Badge = (System.String)dr["Badge"];
                    }
                    else
                    {
                        obj.Badge = "";
                    } 
 if (dr["ID"] != DBNull.Value)
                    {
                        obj.ID = (System.String)dr["ID"];
                    }
                    else
                    {
                        obj.ID = "";
                    } 
 if (dr["BirthDate"] != DBNull.Value)
                    {
                        obj.BirthDate = (System.DateTime?)dr["BirthDate"];
                    }
                    else
                    {
                        obj.BirthDate = null;
                    } 
 if (dr["RelationID"] != DBNull.Value)
                    {
                        obj.RelationID = (System.Int64?)dr["RelationID"];
                    }
                    else
                    {
                        obj.RelationID = null;
                    } 
 if (dr["NationalityID"] != DBNull.Value)
                    {
                        obj.NationalityID = (System.Int64?)dr["NationalityID"];
                    }
                    else
                    {
                        obj.NationalityID = null;
                    } 
 if (dr["OperationAreaID"] != DBNull.Value)
                    {
                        obj.OperationAreaID = (System.Int64?)dr["OperationAreaID"];
                    }
                    else
                    {
                        obj.OperationAreaID = null;
                    } 
 if (dr["PersonTypeID"] != DBNull.Value)
                    {
                        obj.PersonTypeID = (System.Int64?)dr["PersonTypeID"];
                    }
                    else
                    {
                        obj.PersonTypeID = null;
                    } 
 if (dr["ChargeAccount"] != DBNull.Value)
                    {
                        obj.ChargeAccount = (System.String)dr["ChargeAccount"];
                    }
                    else
                    {
                        obj.ChargeAccount = "";
                    } 
 if (dr["OrgChartID"] != DBNull.Value)
                    {
                        obj.OrgChartID = (System.Int64?)dr["OrgChartID"];
                    }
                    else
                    {
                        obj.OrgChartID = null;
                    } 
 if (dr["Email"] != DBNull.Value)
                    {
                        obj.Email = (System.String)dr["Email"];
                    }
                    else
                    {
                        obj.Email = "";
                    } 
 if (dr["Password"] != DBNull.Value)
                    {
                        obj.Password = (System.String)dr["Password"];
                    }
                    else
                    {
                        obj.Password = "";
                    } 
 if (dr["UserTypeID"] != DBNull.Value)
                    {
                        obj.UserTypeID = (System.Int64)dr["UserTypeID"];
                    }
                    else
                    {
                        obj.UserTypeID = -1;
                    } 
 if (dr["Mobile1"] != DBNull.Value)
                    {
                        obj.Mobile1 = (System.String)dr["Mobile1"];
                    }
                    else
                    {
                        obj.Mobile1 = "";
                    } 
 if (dr["Mobile2"] != DBNull.Value)
                    {
                        obj.Mobile2 = (System.String)dr["Mobile2"];
                    }
                    else
                    {
                        obj.Mobile2 = "";
                    } 
 if (dr["Phone1"] != DBNull.Value)
                    {
                        obj.Phone1 = (System.String)dr["Phone1"];
                    }
                    else
                    {
                        obj.Phone1 = "";
                    } 
 if (dr["InnerPhone1"] != DBNull.Value)
                    {
                        obj.InnerPhone1 = (System.String)dr["InnerPhone1"];
                    }
                    else
                    {
                        obj.InnerPhone1 = "";
                    } 
 if (dr["Phone2"] != DBNull.Value)
                    {
                        obj.Phone2 = (System.String)dr["Phone2"];
                    }
                    else
                    {
                        obj.Phone2 = "";
                    } 
 if (dr["InnerPhone2"] != DBNull.Value)
                    {
                        obj.InnerPhone2 = (System.String)dr["InnerPhone2"];
                    }
                    else
                    {
                        obj.InnerPhone2 = "";
                    } 
 if (dr["Language"] != DBNull.Value)
                    {
                        obj.Language = (System.Int64?)dr["Language"];
                    }
                    else
                    {
                        obj.Language = null;
                    } 
 if (dr["StatusID"] != DBNull.Value)
                    {
                        obj.StatusID = (System.Int64)dr["StatusID"];
                    }
                    else
                    {
                        obj.StatusID = -1;
                    } 
 if (dr["Expr1"] != DBNull.Value)
                    {
                        obj.Expr1 = (System.Int64)dr["Expr1"];
                    }
                    else
                    {
                        obj.Expr1 = -1;
                    } 
 if (dr["PersonsID"] != DBNull.Value)
                    {
                        obj.PersonsID = (System.Int64)dr["PersonsID"];
                    }
                    else
                    {
                        obj.PersonsID = -1;
                    } 
 if (dr["RuleID"] != DBNull.Value)
                    {
                        obj.RuleID = (System.Int64)dr["RuleID"];
                    }
                    else
                    {
                        obj.RuleID = -1;
                    } 
 if (dr["Expr2"] != DBNull.Value)
                    {
                        obj.Expr2 = (System.Int64)dr["Expr2"];
                    }
                    else
                    {
                        obj.Expr2 = -1;
                    } 
 if (dr["RuleName"] != DBNull.Value)
                    {
                        obj.RuleName = (System.String)dr["RuleName"];
                    }
                    else
                    {
                        obj.RuleName = "";
                    } 
 if (dr["RuleNameEN"] != DBNull.Value)
                    {
                        obj.RuleNameEN = (System.String)dr["RuleNameEN"];
                    }
                    else
                    {
                        obj.RuleNameEN = "";
                    } 



                    lstRet.Add(obj);
                   

                }
            }

            dr.Close();


            return lstRet;
        }


        public List<PersonsRulesView> Select(string strTop, string strWhere, params DbParameter[] whereParams)
        {
            ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);

            con.OpenConnection();

            List<PersonsRulesView> lstRet = Select(con, strTop, strWhere, whereParams);

            con.CloseConnection();

            return lstRet;
        }

        



        public void Insert(ClassDataHandler con , PersonsRulesView obj)
        {
            
            

                    DbParameter prmGenID = con.createParameter();
                    prmGenID.ParameterName = "@GenID";
                    prmGenID.DbType =DbType.Int64;
                    if (obj.GenID == null)
                    {
                        prmGenID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmGenID.Value = obj.GenID;
                    }
                

                    


                    DbParameter prmName_AR = con.createParameter();
                    prmName_AR.ParameterName = "@Name_AR";
                    prmName_AR.DbType =DbType.String;
                    if (obj.Name_AR == null)
                    {
                        prmName_AR.Value = DBNull.Value;
                    }
                    else
                    {
                        prmName_AR.Value = obj.Name_AR;
                    }
                

                    


                    DbParameter prmName_EN = con.createParameter();
                    prmName_EN.ParameterName = "@Name_EN";
                    prmName_EN.DbType =DbType.String;
                    if (obj.Name_EN == null)
                    {
                        prmName_EN.Value = DBNull.Value;
                    }
                    else
                    {
                        prmName_EN.Value = obj.Name_EN;
                    }
                

                    


                    DbParameter prmMiddleName_AR = con.createParameter();
                    prmMiddleName_AR.ParameterName = "@MiddleName_AR";
                    prmMiddleName_AR.DbType =DbType.String;
                    if (obj.MiddleName_AR == null)
                    {
                        prmMiddleName_AR.Value = DBNull.Value;
                    }
                    else
                    {
                        prmMiddleName_AR.Value = obj.MiddleName_AR;
                    }
                

                    


                    DbParameter prmMiddleName_EN = con.createParameter();
                    prmMiddleName_EN.ParameterName = "@MiddleName_EN";
                    prmMiddleName_EN.DbType =DbType.String;
                    if (obj.MiddleName_EN == null)
                    {
                        prmMiddleName_EN.Value = DBNull.Value;
                    }
                    else
                    {
                        prmMiddleName_EN.Value = obj.MiddleName_EN;
                    }
                

                    


                    DbParameter prmFamilyName_AR = con.createParameter();
                    prmFamilyName_AR.ParameterName = "@FamilyName_AR";
                    prmFamilyName_AR.DbType =DbType.String;
                    if (obj.FamilyName_AR == null)
                    {
                        prmFamilyName_AR.Value = DBNull.Value;
                    }
                    else
                    {
                        prmFamilyName_AR.Value = obj.FamilyName_AR;
                    }
                

                    


                    DbParameter prmFamilyName_EN = con.createParameter();
                    prmFamilyName_EN.ParameterName = "@FamilyName_EN";
                    prmFamilyName_EN.DbType =DbType.String;
                    if (obj.FamilyName_EN == null)
                    {
                        prmFamilyName_EN.Value = DBNull.Value;
                    }
                    else
                    {
                        prmFamilyName_EN.Value = obj.FamilyName_EN;
                    }
                

                    


                    DbParameter prmGender = con.createParameter();
                    prmGender.ParameterName = "@Gender";
                    prmGender.DbType =DbType.Boolean;
                    if (obj.Gender == null)
                    {
                        prmGender.Value = DBNull.Value;
                    }
                    else
                    {
                        prmGender.Value = obj.Gender;
                    }
                

                    


                    DbParameter prmBadge = con.createParameter();
                    prmBadge.ParameterName = "@Badge";
                    prmBadge.DbType =DbType.String;
                    if (obj.Badge == null)
                    {
                        prmBadge.Value = DBNull.Value;
                    }
                    else
                    {
                        prmBadge.Value = obj.Badge;
                    }
                

                    


                    DbParameter prmID = con.createParameter();
                    prmID.ParameterName = "@ID";
                    prmID.DbType =DbType.String;
                    if (obj.ID == null)
                    {
                        prmID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmID.Value = obj.ID;
                    }
                

                    


                    DbParameter prmBirthDate = con.createParameter();
                    prmBirthDate.ParameterName = "@BirthDate";
                    prmBirthDate.DbType =DbType.DateTime;
                    if (obj.BirthDate == null)
                    {
                        prmBirthDate.Value = DBNull.Value;
                    }
                    else
                    {
                        prmBirthDate.Value = obj.BirthDate;
                    }
                

                    


                    DbParameter prmRelationID = con.createParameter();
                    prmRelationID.ParameterName = "@RelationID";
                    prmRelationID.DbType =DbType.Int64;
                    if (obj.RelationID == null)
                    {
                        prmRelationID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmRelationID.Value = obj.RelationID;
                    }
                

                    


                    DbParameter prmNationalityID = con.createParameter();
                    prmNationalityID.ParameterName = "@NationalityID";
                    prmNationalityID.DbType =DbType.Int64;
                    if (obj.NationalityID == null)
                    {
                        prmNationalityID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmNationalityID.Value = obj.NationalityID;
                    }
                

                    


                    DbParameter prmOperationAreaID = con.createParameter();
                    prmOperationAreaID.ParameterName = "@OperationAreaID";
                    prmOperationAreaID.DbType =DbType.Int64;
                    if (obj.OperationAreaID == null)
                    {
                        prmOperationAreaID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmOperationAreaID.Value = obj.OperationAreaID;
                    }
                

                    


                    DbParameter prmPersonTypeID = con.createParameter();
                    prmPersonTypeID.ParameterName = "@PersonTypeID";
                    prmPersonTypeID.DbType =DbType.Int64;
                    if (obj.PersonTypeID == null)
                    {
                        prmPersonTypeID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmPersonTypeID.Value = obj.PersonTypeID;
                    }
                

                    


                    DbParameter prmChargeAccount = con.createParameter();
                    prmChargeAccount.ParameterName = "@ChargeAccount";
                    prmChargeAccount.DbType =DbType.String;
                    if (obj.ChargeAccount == null)
                    {
                        prmChargeAccount.Value = DBNull.Value;
                    }
                    else
                    {
                        prmChargeAccount.Value = obj.ChargeAccount;
                    }
                

                    


                    DbParameter prmOrgChartID = con.createParameter();
                    prmOrgChartID.ParameterName = "@OrgChartID";
                    prmOrgChartID.DbType =DbType.Int64;
                    if (obj.OrgChartID == null)
                    {
                        prmOrgChartID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmOrgChartID.Value = obj.OrgChartID;
                    }
                

                    


                    DbParameter prmEmail = con.createParameter();
                    prmEmail.ParameterName = "@Email";
                    prmEmail.DbType =DbType.String;
                    if (obj.Email == null)
                    {
                        prmEmail.Value = DBNull.Value;
                    }
                    else
                    {
                        prmEmail.Value = obj.Email;
                    }
                

                    


                    DbParameter prmPassword = con.createParameter();
                    prmPassword.ParameterName = "@Password";
                    prmPassword.DbType =DbType.String;
                    if (obj.Password == null)
                    {
                        prmPassword.Value = DBNull.Value;
                    }
                    else
                    {
                        prmPassword.Value = obj.Password;
                    }
                

                    


                    DbParameter prmUserTypeID = con.createParameter();
                    prmUserTypeID.ParameterName = "@UserTypeID";
                    prmUserTypeID.DbType =DbType.Int64;
                    if (obj.UserTypeID == null)
                    {
                        prmUserTypeID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmUserTypeID.Value = obj.UserTypeID;
                    }
                

                    


                    DbParameter prmMobile1 = con.createParameter();
                    prmMobile1.ParameterName = "@Mobile1";
                    prmMobile1.DbType =DbType.String;
                    if (obj.Mobile1 == null)
                    {
                        prmMobile1.Value = DBNull.Value;
                    }
                    else
                    {
                        prmMobile1.Value = obj.Mobile1;
                    }
                

                    


                    DbParameter prmMobile2 = con.createParameter();
                    prmMobile2.ParameterName = "@Mobile2";
                    prmMobile2.DbType =DbType.String;
                    if (obj.Mobile2 == null)
                    {
                        prmMobile2.Value = DBNull.Value;
                    }
                    else
                    {
                        prmMobile2.Value = obj.Mobile2;
                    }
                

                    


                    DbParameter prmPhone1 = con.createParameter();
                    prmPhone1.ParameterName = "@Phone1";
                    prmPhone1.DbType =DbType.String;
                    if (obj.Phone1 == null)
                    {
                        prmPhone1.Value = DBNull.Value;
                    }
                    else
                    {
                        prmPhone1.Value = obj.Phone1;
                    }
                

                    


                    DbParameter prmInnerPhone1 = con.createParameter();
                    prmInnerPhone1.ParameterName = "@InnerPhone1";
                    prmInnerPhone1.DbType =DbType.String;
                    if (obj.InnerPhone1 == null)
                    {
                        prmInnerPhone1.Value = DBNull.Value;
                    }
                    else
                    {
                        prmInnerPhone1.Value = obj.InnerPhone1;
                    }
                

                    


                    DbParameter prmPhone2 = con.createParameter();
                    prmPhone2.ParameterName = "@Phone2";
                    prmPhone2.DbType =DbType.String;
                    if (obj.Phone2 == null)
                    {
                        prmPhone2.Value = DBNull.Value;
                    }
                    else
                    {
                        prmPhone2.Value = obj.Phone2;
                    }
                

                    


                    DbParameter prmInnerPhone2 = con.createParameter();
                    prmInnerPhone2.ParameterName = "@InnerPhone2";
                    prmInnerPhone2.DbType =DbType.String;
                    if (obj.InnerPhone2 == null)
                    {
                        prmInnerPhone2.Value = DBNull.Value;
                    }
                    else
                    {
                        prmInnerPhone2.Value = obj.InnerPhone2;
                    }
                

                    


                    DbParameter prmLanguage = con.createParameter();
                    prmLanguage.ParameterName = "@Language";
                    prmLanguage.DbType =DbType.Int64;
                    if (obj.Language == null)
                    {
                        prmLanguage.Value = DBNull.Value;
                    }
                    else
                    {
                        prmLanguage.Value = obj.Language;
                    }
                

                    


                    DbParameter prmStatusID = con.createParameter();
                    prmStatusID.ParameterName = "@StatusID";
                    prmStatusID.DbType =DbType.Int64;
                    if (obj.StatusID == null)
                    {
                        prmStatusID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmStatusID.Value = obj.StatusID;
                    }
                

                    


                    DbParameter prmExpr1 = con.createParameter();
                    prmExpr1.ParameterName = "@Expr1";
                    prmExpr1.DbType =DbType.Int64;
                    if (obj.Expr1 == null)
                    {
                        prmExpr1.Value = DBNull.Value;
                    }
                    else
                    {
                        prmExpr1.Value = obj.Expr1;
                    }
                

                    


                    DbParameter prmPersonsID = con.createParameter();
                    prmPersonsID.ParameterName = "@PersonsID";
                    prmPersonsID.DbType =DbType.Int64;
                    if (obj.PersonsID == null)
                    {
                        prmPersonsID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmPersonsID.Value = obj.PersonsID;
                    }
                

                    


                    DbParameter prmRuleID = con.createParameter();
                    prmRuleID.ParameterName = "@RuleID";
                    prmRuleID.DbType =DbType.Int64;
                    if (obj.RuleID == null)
                    {
                        prmRuleID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmRuleID.Value = obj.RuleID;
                    }
                

                    


                    DbParameter prmExpr2 = con.createParameter();
                    prmExpr2.ParameterName = "@Expr2";
                    prmExpr2.DbType =DbType.Int64;
                    if (obj.Expr2 == null)
                    {
                        prmExpr2.Value = DBNull.Value;
                    }
                    else
                    {
                        prmExpr2.Value = obj.Expr2;
                    }
                

                    


                    DbParameter prmRuleName = con.createParameter();
                    prmRuleName.ParameterName = "@RuleName";
                    prmRuleName.DbType =DbType.String;
                    if (obj.RuleName == null)
                    {
                        prmRuleName.Value = DBNull.Value;
                    }
                    else
                    {
                        prmRuleName.Value = obj.RuleName;
                    }
                

                    


                    DbParameter prmRuleNameEN = con.createParameter();
                    prmRuleNameEN.ParameterName = "@RuleNameEN";
                    prmRuleNameEN.DbType =DbType.String;
                    if (obj.RuleNameEN == null)
                    {
                        prmRuleNameEN.Value = DBNull.Value;
                    }
                    else
                    {
                        prmRuleNameEN.Value = obj.RuleNameEN;
                    }
                

                    


           



            string strQuery = " insert into dbo.[PersonsRulesView] ([GenID],[Name_AR],[Name_EN],[MiddleName_AR],[MiddleName_EN],[FamilyName_AR],[FamilyName_EN],[Gender],[Badge],[ID],[BirthDate],[RelationID],[NationalityID],[OperationAreaID],[PersonTypeID],[ChargeAccount],[OrgChartID],[Email],[Password],[UserTypeID],[Mobile1],[Mobile2],[Phone1],[InnerPhone1],[Phone2],[InnerPhone2],[Language],[StatusID],[Expr1],[PersonsID],[RuleID],[Expr2],[RuleName],[RuleNameEN]) VALUES (@GenID,@Name_AR,@Name_EN,@MiddleName_AR,@MiddleName_EN,@FamilyName_AR,@FamilyName_EN,@Gender,@Badge,@ID,@BirthDate,@RelationID,@NationalityID,@OperationAreaID,@PersonTypeID,@ChargeAccount,@OrgChartID,@Email,@Password,@UserTypeID,@Mobile1,@Mobile2,@Phone1,@InnerPhone1,@Phone2,@InnerPhone2,@Language,@StatusID,@Expr1,@PersonsID,@RuleID,@Expr2,@RuleName,@RuleNameEN) ; select SCOPE_IDENTITY() ";
 object scope = con.ExecuteScalar(strQuery, CommandType.Text, prmGenID,prmName_AR,prmName_EN,prmMiddleName_AR,prmMiddleName_EN,prmFamilyName_AR,prmFamilyName_EN,prmGender,prmBadge,prmID,prmBirthDate,prmRelationID,prmNationalityID,prmOperationAreaID,prmPersonTypeID,prmChargeAccount,prmOrgChartID,prmEmail,prmPassword,prmUserTypeID,prmMobile1,prmMobile2,prmPhone1,prmInnerPhone1,prmPhone2,prmInnerPhone2,prmLanguage,prmStatusID,prmExpr1,prmPersonsID,prmRuleID,prmExpr2,prmRuleName,prmRuleNameEN);


           

        }



        public void Insert(PersonsRulesView obj)
        {
            ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
            con.OpenConnection();

            Insert(con,obj);


            con.CloseConnection();
        }




        public void Update(ClassDataHandler con, PersonsRulesView obj)
        {
            
            

                    DbParameter prmGenID = con.createParameter();
                    prmGenID.ParameterName = "@GenID";
                    prmGenID.DbType =DbType.Int64;
                    if (obj.GenID == null)
                    {
                        prmGenID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmGenID.Value = obj.GenID;
                    }
                

                    


                    DbParameter prmName_AR = con.createParameter();
                    prmName_AR.ParameterName = "@Name_AR";
                    prmName_AR.DbType =DbType.String;
                    if (obj.Name_AR == null)
                    {
                        prmName_AR.Value = DBNull.Value;
                    }
                    else
                    {
                        prmName_AR.Value = obj.Name_AR;
                    }
                

                    


                    DbParameter prmName_EN = con.createParameter();
                    prmName_EN.ParameterName = "@Name_EN";
                    prmName_EN.DbType =DbType.String;
                    if (obj.Name_EN == null)
                    {
                        prmName_EN.Value = DBNull.Value;
                    }
                    else
                    {
                        prmName_EN.Value = obj.Name_EN;
                    }
                

                    


                    DbParameter prmMiddleName_AR = con.createParameter();
                    prmMiddleName_AR.ParameterName = "@MiddleName_AR";
                    prmMiddleName_AR.DbType =DbType.String;
                    if (obj.MiddleName_AR == null)
                    {
                        prmMiddleName_AR.Value = DBNull.Value;
                    }
                    else
                    {
                        prmMiddleName_AR.Value = obj.MiddleName_AR;
                    }
                

                    


                    DbParameter prmMiddleName_EN = con.createParameter();
                    prmMiddleName_EN.ParameterName = "@MiddleName_EN";
                    prmMiddleName_EN.DbType =DbType.String;
                    if (obj.MiddleName_EN == null)
                    {
                        prmMiddleName_EN.Value = DBNull.Value;
                    }
                    else
                    {
                        prmMiddleName_EN.Value = obj.MiddleName_EN;
                    }
                

                    


                    DbParameter prmFamilyName_AR = con.createParameter();
                    prmFamilyName_AR.ParameterName = "@FamilyName_AR";
                    prmFamilyName_AR.DbType =DbType.String;
                    if (obj.FamilyName_AR == null)
                    {
                        prmFamilyName_AR.Value = DBNull.Value;
                    }
                    else
                    {
                        prmFamilyName_AR.Value = obj.FamilyName_AR;
                    }
                

                    


                    DbParameter prmFamilyName_EN = con.createParameter();
                    prmFamilyName_EN.ParameterName = "@FamilyName_EN";
                    prmFamilyName_EN.DbType =DbType.String;
                    if (obj.FamilyName_EN == null)
                    {
                        prmFamilyName_EN.Value = DBNull.Value;
                    }
                    else
                    {
                        prmFamilyName_EN.Value = obj.FamilyName_EN;
                    }
                

                    


                    DbParameter prmGender = con.createParameter();
                    prmGender.ParameterName = "@Gender";
                    prmGender.DbType =DbType.Boolean;
                    if (obj.Gender == null)
                    {
                        prmGender.Value = DBNull.Value;
                    }
                    else
                    {
                        prmGender.Value = obj.Gender;
                    }
                

                    


                    DbParameter prmBadge = con.createParameter();
                    prmBadge.ParameterName = "@Badge";
                    prmBadge.DbType =DbType.String;
                    if (obj.Badge == null)
                    {
                        prmBadge.Value = DBNull.Value;
                    }
                    else
                    {
                        prmBadge.Value = obj.Badge;
                    }
                

                    


                    DbParameter prmID = con.createParameter();
                    prmID.ParameterName = "@ID";
                    prmID.DbType =DbType.String;
                    if (obj.ID == null)
                    {
                        prmID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmID.Value = obj.ID;
                    }
                

                    


                    DbParameter prmBirthDate = con.createParameter();
                    prmBirthDate.ParameterName = "@BirthDate";
                    prmBirthDate.DbType =DbType.DateTime;
                    if (obj.BirthDate == null)
                    {
                        prmBirthDate.Value = DBNull.Value;
                    }
                    else
                    {
                        prmBirthDate.Value = obj.BirthDate;
                    }
                

                    


                    DbParameter prmRelationID = con.createParameter();
                    prmRelationID.ParameterName = "@RelationID";
                    prmRelationID.DbType =DbType.Int64;
                    if (obj.RelationID == null)
                    {
                        prmRelationID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmRelationID.Value = obj.RelationID;
                    }
                

                    


                    DbParameter prmNationalityID = con.createParameter();
                    prmNationalityID.ParameterName = "@NationalityID";
                    prmNationalityID.DbType =DbType.Int64;
                    if (obj.NationalityID == null)
                    {
                        prmNationalityID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmNationalityID.Value = obj.NationalityID;
                    }
                

                    


                    DbParameter prmOperationAreaID = con.createParameter();
                    prmOperationAreaID.ParameterName = "@OperationAreaID";
                    prmOperationAreaID.DbType =DbType.Int64;
                    if (obj.OperationAreaID == null)
                    {
                        prmOperationAreaID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmOperationAreaID.Value = obj.OperationAreaID;
                    }
                

                    


                    DbParameter prmPersonTypeID = con.createParameter();
                    prmPersonTypeID.ParameterName = "@PersonTypeID";
                    prmPersonTypeID.DbType =DbType.Int64;
                    if (obj.PersonTypeID == null)
                    {
                        prmPersonTypeID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmPersonTypeID.Value = obj.PersonTypeID;
                    }
                

                    


                    DbParameter prmChargeAccount = con.createParameter();
                    prmChargeAccount.ParameterName = "@ChargeAccount";
                    prmChargeAccount.DbType =DbType.String;
                    if (obj.ChargeAccount == null)
                    {
                        prmChargeAccount.Value = DBNull.Value;
                    }
                    else
                    {
                        prmChargeAccount.Value = obj.ChargeAccount;
                    }
                

                    


                    DbParameter prmOrgChartID = con.createParameter();
                    prmOrgChartID.ParameterName = "@OrgChartID";
                    prmOrgChartID.DbType =DbType.Int64;
                    if (obj.OrgChartID == null)
                    {
                        prmOrgChartID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmOrgChartID.Value = obj.OrgChartID;
                    }
                

                    


                    DbParameter prmEmail = con.createParameter();
                    prmEmail.ParameterName = "@Email";
                    prmEmail.DbType =DbType.String;
                    if (obj.Email == null)
                    {
                        prmEmail.Value = DBNull.Value;
                    }
                    else
                    {
                        prmEmail.Value = obj.Email;
                    }
                

                    


                    DbParameter prmPassword = con.createParameter();
                    prmPassword.ParameterName = "@Password";
                    prmPassword.DbType =DbType.String;
                    if (obj.Password == null)
                    {
                        prmPassword.Value = DBNull.Value;
                    }
                    else
                    {
                        prmPassword.Value = obj.Password;
                    }
                

                    


                    DbParameter prmUserTypeID = con.createParameter();
                    prmUserTypeID.ParameterName = "@UserTypeID";
                    prmUserTypeID.DbType =DbType.Int64;
                    if (obj.UserTypeID == null)
                    {
                        prmUserTypeID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmUserTypeID.Value = obj.UserTypeID;
                    }
                

                    


                    DbParameter prmMobile1 = con.createParameter();
                    prmMobile1.ParameterName = "@Mobile1";
                    prmMobile1.DbType =DbType.String;
                    if (obj.Mobile1 == null)
                    {
                        prmMobile1.Value = DBNull.Value;
                    }
                    else
                    {
                        prmMobile1.Value = obj.Mobile1;
                    }
                

                    


                    DbParameter prmMobile2 = con.createParameter();
                    prmMobile2.ParameterName = "@Mobile2";
                    prmMobile2.DbType =DbType.String;
                    if (obj.Mobile2 == null)
                    {
                        prmMobile2.Value = DBNull.Value;
                    }
                    else
                    {
                        prmMobile2.Value = obj.Mobile2;
                    }
                

                    


                    DbParameter prmPhone1 = con.createParameter();
                    prmPhone1.ParameterName = "@Phone1";
                    prmPhone1.DbType =DbType.String;
                    if (obj.Phone1 == null)
                    {
                        prmPhone1.Value = DBNull.Value;
                    }
                    else
                    {
                        prmPhone1.Value = obj.Phone1;
                    }
                

                    


                    DbParameter prmInnerPhone1 = con.createParameter();
                    prmInnerPhone1.ParameterName = "@InnerPhone1";
                    prmInnerPhone1.DbType =DbType.String;
                    if (obj.InnerPhone1 == null)
                    {
                        prmInnerPhone1.Value = DBNull.Value;
                    }
                    else
                    {
                        prmInnerPhone1.Value = obj.InnerPhone1;
                    }
                

                    


                    DbParameter prmPhone2 = con.createParameter();
                    prmPhone2.ParameterName = "@Phone2";
                    prmPhone2.DbType =DbType.String;
                    if (obj.Phone2 == null)
                    {
                        prmPhone2.Value = DBNull.Value;
                    }
                    else
                    {
                        prmPhone2.Value = obj.Phone2;
                    }
                

                    


                    DbParameter prmInnerPhone2 = con.createParameter();
                    prmInnerPhone2.ParameterName = "@InnerPhone2";
                    prmInnerPhone2.DbType =DbType.String;
                    if (obj.InnerPhone2 == null)
                    {
                        prmInnerPhone2.Value = DBNull.Value;
                    }
                    else
                    {
                        prmInnerPhone2.Value = obj.InnerPhone2;
                    }
                

                    


                    DbParameter prmLanguage = con.createParameter();
                    prmLanguage.ParameterName = "@Language";
                    prmLanguage.DbType =DbType.Int64;
                    if (obj.Language == null)
                    {
                        prmLanguage.Value = DBNull.Value;
                    }
                    else
                    {
                        prmLanguage.Value = obj.Language;
                    }
                

                    


                    DbParameter prmStatusID = con.createParameter();
                    prmStatusID.ParameterName = "@StatusID";
                    prmStatusID.DbType =DbType.Int64;
                    if (obj.StatusID == null)
                    {
                        prmStatusID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmStatusID.Value = obj.StatusID;
                    }
                

                    


                    DbParameter prmExpr1 = con.createParameter();
                    prmExpr1.ParameterName = "@Expr1";
                    prmExpr1.DbType =DbType.Int64;
                    if (obj.Expr1 == null)
                    {
                        prmExpr1.Value = DBNull.Value;
                    }
                    else
                    {
                        prmExpr1.Value = obj.Expr1;
                    }
                

                    


                    DbParameter prmPersonsID = con.createParameter();
                    prmPersonsID.ParameterName = "@PersonsID";
                    prmPersonsID.DbType =DbType.Int64;
                    if (obj.PersonsID == null)
                    {
                        prmPersonsID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmPersonsID.Value = obj.PersonsID;
                    }
                

                    


                    DbParameter prmRuleID = con.createParameter();
                    prmRuleID.ParameterName = "@RuleID";
                    prmRuleID.DbType =DbType.Int64;
                    if (obj.RuleID == null)
                    {
                        prmRuleID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmRuleID.Value = obj.RuleID;
                    }
                

                    


                    DbParameter prmExpr2 = con.createParameter();
                    prmExpr2.ParameterName = "@Expr2";
                    prmExpr2.DbType =DbType.Int64;
                    if (obj.Expr2 == null)
                    {
                        prmExpr2.Value = DBNull.Value;
                    }
                    else
                    {
                        prmExpr2.Value = obj.Expr2;
                    }
                

                    


                    DbParameter prmRuleName = con.createParameter();
                    prmRuleName.ParameterName = "@RuleName";
                    prmRuleName.DbType =DbType.String;
                    if (obj.RuleName == null)
                    {
                        prmRuleName.Value = DBNull.Value;
                    }
                    else
                    {
                        prmRuleName.Value = obj.RuleName;
                    }
                

                    


                    DbParameter prmRuleNameEN = con.createParameter();
                    prmRuleNameEN.ParameterName = "@RuleNameEN";
                    prmRuleNameEN.DbType =DbType.String;
                    if (obj.RuleNameEN == null)
                    {
                        prmRuleNameEN.Value = DBNull.Value;
                    }
                    else
                    {
                        prmRuleNameEN.Value = obj.RuleNameEN;
                    }
                

                    


           



            string strQuery = " update dbo.[PersonsRulesView] set [Name_AR]=@Name_AR,[Name_EN]=@Name_EN,[MiddleName_AR]=@MiddleName_AR,[MiddleName_EN]=@MiddleName_EN,[FamilyName_AR]=@FamilyName_AR,[FamilyName_EN]=@FamilyName_EN,[Gender]=@Gender,[Badge]=@Badge,[ID]=@ID,[BirthDate]=@BirthDate,[RelationID]=@RelationID,[NationalityID]=@NationalityID,[OperationAreaID]=@OperationAreaID,[PersonTypeID]=@PersonTypeID,[ChargeAccount]=@ChargeAccount,[OrgChartID]=@OrgChartID,[Email]=@Email,[Password]=@Password,[UserTypeID]=@UserTypeID,[Mobile1]=@Mobile1,[Mobile2]=@Mobile2,[Phone1]=@Phone1,[InnerPhone1]=@InnerPhone1,[Phone2]=@Phone2,[InnerPhone2]=@InnerPhone2,[Language]=@Language,[StatusID]=@StatusID,[PersonsID]=@PersonsID,[RuleID]=@RuleID,[RuleName]=@RuleName,[RuleNameEN]=@RuleNameEN where  [GenID]=@GenID and  [Expr1]=@Expr1 and  [Expr2]=@Expr2  ";

            con.ExecuteNonQuery(strQuery, CommandType.Text,prmGenID,prmName_AR,prmName_EN,prmMiddleName_AR,prmMiddleName_EN,prmFamilyName_AR,prmFamilyName_EN,prmGender,prmBadge,prmID,prmBirthDate,prmRelationID,prmNationalityID,prmOperationAreaID,prmPersonTypeID,prmChargeAccount,prmOrgChartID,prmEmail,prmPassword,prmUserTypeID,prmMobile1,prmMobile2,prmPhone1,prmInnerPhone1,prmPhone2,prmInnerPhone2,prmLanguage,prmStatusID,prmExpr1,prmPersonsID,prmRuleID,prmExpr2,prmRuleName,prmRuleNameEN);

            

        }


        public void Update(PersonsRulesView obj)
        {
            ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
            con.OpenConnection();

            Update(con, obj);


            con.CloseConnection();
        }



        public void Delete(ClassDataHandler con, PersonsRulesView obj)
        {

            

                    DbParameter prmGenID = con.createParameter();
                    prmGenID.ParameterName = "@GenID";
                    prmGenID.DbType =DbType.Int64;
                    if (obj.GenID == null)
                    {
                        prmGenID.Value = DBNull.Value;
                    }
                    else
                    {
                        prmGenID.Value = obj.GenID;
                    }
                

                    


                    DbParameter prmExpr1 = con.createParameter();
                    prmExpr1.ParameterName = "@Expr1";
                    prmExpr1.DbType =DbType.Int64;
                    if (obj.Expr1 == null)
                    {
                        prmExpr1.Value = DBNull.Value;
                    }
                    else
                    {
                        prmExpr1.Value = obj.Expr1;
                    }
                

                    


                    DbParameter prmExpr2 = con.createParameter();
                    prmExpr2.ParameterName = "@Expr2";
                    prmExpr2.DbType =DbType.Int64;
                    if (obj.Expr2 == null)
                    {
                        prmExpr2.Value = DBNull.Value;
                    }
                    else
                    {
                        prmExpr2.Value = obj.Expr2;
                    }
                

                    


           



           



            string strQuery = " delete from dbo.[PersonsRulesView]  where  [GenID]=@GenID and  [Expr1]=@Expr1 and  [Expr2]=@Expr2  "; 
                        con.ExecuteNonQuery(strQuery, CommandType.Text,prmGenID,prmExpr1,prmExpr2 );  

             



        }


        public void Delete( PersonsRulesView obj)
        {
            ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);

            con.OpenConnection();

            Delete(con, obj);

            con.CloseConnection();
        }





                    public List<PersonsRulesView> getPersonsRulesViewByGenID(ClassDataHandler con,System.Int64 GenID)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmGenID = con.createParameter();
                        prmGenID.ParameterName = "@GenID";
                        prmGenID.DbType = DbType.Int64;
                        if (GenID == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmGenID.Value = GenID;
                        }


                        lstRet = Select(con, "" , " where [GenID]=@GenID ", prmGenID);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByGenID(System.Int64 GenID)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByGenID(con, GenID);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByName_AR(ClassDataHandler con,System.String Name_AR)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmName_AR = con.createParameter();
                        prmName_AR.ParameterName = "@Name_AR";
                        prmName_AR.DbType = DbType.String;
                        if (Name_AR == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmName_AR.Value = Name_AR;
                        }


                        lstRet = Select(con, "" , " where [Name_AR]=@Name_AR ", prmName_AR);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByName_AR(System.String Name_AR)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByName_AR(con, Name_AR);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByName_EN(ClassDataHandler con,System.String Name_EN)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmName_EN = con.createParameter();
                        prmName_EN.ParameterName = "@Name_EN";
                        prmName_EN.DbType = DbType.String;
                        if (Name_EN == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmName_EN.Value = Name_EN;
                        }


                        lstRet = Select(con, "" , " where [Name_EN]=@Name_EN ", prmName_EN);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByName_EN(System.String Name_EN)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByName_EN(con, Name_EN);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByMiddleName_AR(ClassDataHandler con,System.String MiddleName_AR)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmMiddleName_AR = con.createParameter();
                        prmMiddleName_AR.ParameterName = "@MiddleName_AR";
                        prmMiddleName_AR.DbType = DbType.String;
                        if (MiddleName_AR == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmMiddleName_AR.Value = MiddleName_AR;
                        }


                        lstRet = Select(con, "" , " where [MiddleName_AR]=@MiddleName_AR ", prmMiddleName_AR);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByMiddleName_AR(System.String MiddleName_AR)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByMiddleName_AR(con, MiddleName_AR);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByMiddleName_EN(ClassDataHandler con,System.String MiddleName_EN)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmMiddleName_EN = con.createParameter();
                        prmMiddleName_EN.ParameterName = "@MiddleName_EN";
                        prmMiddleName_EN.DbType = DbType.String;
                        if (MiddleName_EN == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmMiddleName_EN.Value = MiddleName_EN;
                        }


                        lstRet = Select(con, "" , " where [MiddleName_EN]=@MiddleName_EN ", prmMiddleName_EN);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByMiddleName_EN(System.String MiddleName_EN)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByMiddleName_EN(con, MiddleName_EN);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByFamilyName_AR(ClassDataHandler con,System.String FamilyName_AR)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmFamilyName_AR = con.createParameter();
                        prmFamilyName_AR.ParameterName = "@FamilyName_AR";
                        prmFamilyName_AR.DbType = DbType.String;
                        if (FamilyName_AR == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmFamilyName_AR.Value = FamilyName_AR;
                        }


                        lstRet = Select(con, "" , " where [FamilyName_AR]=@FamilyName_AR ", prmFamilyName_AR);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByFamilyName_AR(System.String FamilyName_AR)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByFamilyName_AR(con, FamilyName_AR);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByFamilyName_EN(ClassDataHandler con,System.String FamilyName_EN)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmFamilyName_EN = con.createParameter();
                        prmFamilyName_EN.ParameterName = "@FamilyName_EN";
                        prmFamilyName_EN.DbType = DbType.String;
                        if (FamilyName_EN == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmFamilyName_EN.Value = FamilyName_EN;
                        }


                        lstRet = Select(con, "" , " where [FamilyName_EN]=@FamilyName_EN ", prmFamilyName_EN);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByFamilyName_EN(System.String FamilyName_EN)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByFamilyName_EN(con, FamilyName_EN);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByGender(ClassDataHandler con,System.Boolean Gender)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmGender = con.createParameter();
                        prmGender.ParameterName = "@Gender";
                        prmGender.DbType = DbType.Boolean;
                        if (Gender == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmGender.Value = Gender;
                        }


                        lstRet = Select(con, "" , " where [Gender]=@Gender ", prmGender);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByGender(System.Boolean Gender)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByGender(con, Gender);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByBadge(ClassDataHandler con,System.String Badge)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmBadge = con.createParameter();
                        prmBadge.ParameterName = "@Badge";
                        prmBadge.DbType = DbType.String;
                        if (Badge == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmBadge.Value = Badge;
                        }


                        lstRet = Select(con, "" , " where [Badge]=@Badge ", prmBadge);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByBadge(System.String Badge)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByBadge(con, Badge);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByID(ClassDataHandler con,System.String ID)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmID = con.createParameter();
                        prmID.ParameterName = "@ID";
                        prmID.DbType = DbType.String;
                        if (ID == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmID.Value = ID;
                        }


                        lstRet = Select(con, "" , " where [ID]=@ID ", prmID);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByID(System.String ID)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByID(con, ID);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByBirthDate(ClassDataHandler con,System.DateTime? BirthDate)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmBirthDate = con.createParameter();
                        prmBirthDate.ParameterName = "@BirthDate";
                        prmBirthDate.DbType = DbType.DateTime;
                        if (BirthDate == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmBirthDate.Value = BirthDate;
                        }


                        lstRet = Select(con, "" , " where [BirthDate]=@BirthDate ", prmBirthDate);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByBirthDate(System.DateTime? BirthDate)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByBirthDate(con, BirthDate);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByRelationID(ClassDataHandler con,System.Int64? RelationID)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmRelationID = con.createParameter();
                        prmRelationID.ParameterName = "@RelationID";
                        prmRelationID.DbType = DbType.Int64;
                        if (RelationID == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmRelationID.Value = RelationID;
                        }


                        lstRet = Select(con, "" , " where [RelationID]=@RelationID ", prmRelationID);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByRelationID(System.Int64? RelationID)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByRelationID(con, RelationID);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByNationalityID(ClassDataHandler con,System.Int64? NationalityID)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmNationalityID = con.createParameter();
                        prmNationalityID.ParameterName = "@NationalityID";
                        prmNationalityID.DbType = DbType.Int64;
                        if (NationalityID == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmNationalityID.Value = NationalityID;
                        }


                        lstRet = Select(con, "" , " where [NationalityID]=@NationalityID ", prmNationalityID);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByNationalityID(System.Int64? NationalityID)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByNationalityID(con, NationalityID);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByOperationAreaID(ClassDataHandler con,System.Int64? OperationAreaID)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmOperationAreaID = con.createParameter();
                        prmOperationAreaID.ParameterName = "@OperationAreaID";
                        prmOperationAreaID.DbType = DbType.Int64;
                        if (OperationAreaID == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmOperationAreaID.Value = OperationAreaID;
                        }


                        lstRet = Select(con, "" , " where [OperationAreaID]=@OperationAreaID ", prmOperationAreaID);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByOperationAreaID(System.Int64? OperationAreaID)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByOperationAreaID(con, OperationAreaID);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByPersonTypeID(ClassDataHandler con,System.Int64? PersonTypeID)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmPersonTypeID = con.createParameter();
                        prmPersonTypeID.ParameterName = "@PersonTypeID";
                        prmPersonTypeID.DbType = DbType.Int64;
                        if (PersonTypeID == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmPersonTypeID.Value = PersonTypeID;
                        }


                        lstRet = Select(con, "" , " where [PersonTypeID]=@PersonTypeID ", prmPersonTypeID);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByPersonTypeID(System.Int64? PersonTypeID)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByPersonTypeID(con, PersonTypeID);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByChargeAccount(ClassDataHandler con,System.String ChargeAccount)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmChargeAccount = con.createParameter();
                        prmChargeAccount.ParameterName = "@ChargeAccount";
                        prmChargeAccount.DbType = DbType.String;
                        if (ChargeAccount == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmChargeAccount.Value = ChargeAccount;
                        }


                        lstRet = Select(con, "" , " where [ChargeAccount]=@ChargeAccount ", prmChargeAccount);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByChargeAccount(System.String ChargeAccount)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByChargeAccount(con, ChargeAccount);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByOrgChartID(ClassDataHandler con,System.Int64? OrgChartID)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmOrgChartID = con.createParameter();
                        prmOrgChartID.ParameterName = "@OrgChartID";
                        prmOrgChartID.DbType = DbType.Int64;
                        if (OrgChartID == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmOrgChartID.Value = OrgChartID;
                        }


                        lstRet = Select(con, "" , " where [OrgChartID]=@OrgChartID ", prmOrgChartID);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByOrgChartID(System.Int64? OrgChartID)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByOrgChartID(con, OrgChartID);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByEmail(ClassDataHandler con,System.String Email)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmEmail = con.createParameter();
                        prmEmail.ParameterName = "@Email";
                        prmEmail.DbType = DbType.String;
                        if (Email == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmEmail.Value = Email;
                        }


                        lstRet = Select(con, "" , " where [Email]=@Email ", prmEmail);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByEmail(System.String Email)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByEmail(con, Email);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByPassword(ClassDataHandler con,System.String Password)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmPassword = con.createParameter();
                        prmPassword.ParameterName = "@Password";
                        prmPassword.DbType = DbType.String;
                        if (Password == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmPassword.Value = Password;
                        }


                        lstRet = Select(con, "" , " where [Password]=@Password ", prmPassword);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByPassword(System.String Password)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByPassword(con, Password);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByUserTypeID(ClassDataHandler con,System.Int64 UserTypeID)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmUserTypeID = con.createParameter();
                        prmUserTypeID.ParameterName = "@UserTypeID";
                        prmUserTypeID.DbType = DbType.Int64;
                        if (UserTypeID == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmUserTypeID.Value = UserTypeID;
                        }


                        lstRet = Select(con, "" , " where [UserTypeID]=@UserTypeID ", prmUserTypeID);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByUserTypeID(System.Int64 UserTypeID)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByUserTypeID(con, UserTypeID);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByMobile1(ClassDataHandler con,System.String Mobile1)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmMobile1 = con.createParameter();
                        prmMobile1.ParameterName = "@Mobile1";
                        prmMobile1.DbType = DbType.String;
                        if (Mobile1 == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmMobile1.Value = Mobile1;
                        }


                        lstRet = Select(con, "" , " where [Mobile1]=@Mobile1 ", prmMobile1);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByMobile1(System.String Mobile1)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByMobile1(con, Mobile1);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByMobile2(ClassDataHandler con,System.String Mobile2)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmMobile2 = con.createParameter();
                        prmMobile2.ParameterName = "@Mobile2";
                        prmMobile2.DbType = DbType.String;
                        if (Mobile2 == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmMobile2.Value = Mobile2;
                        }


                        lstRet = Select(con, "" , " where [Mobile2]=@Mobile2 ", prmMobile2);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByMobile2(System.String Mobile2)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByMobile2(con, Mobile2);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByPhone1(ClassDataHandler con,System.String Phone1)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmPhone1 = con.createParameter();
                        prmPhone1.ParameterName = "@Phone1";
                        prmPhone1.DbType = DbType.String;
                        if (Phone1 == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmPhone1.Value = Phone1;
                        }


                        lstRet = Select(con, "" , " where [Phone1]=@Phone1 ", prmPhone1);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByPhone1(System.String Phone1)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByPhone1(con, Phone1);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByInnerPhone1(ClassDataHandler con,System.String InnerPhone1)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmInnerPhone1 = con.createParameter();
                        prmInnerPhone1.ParameterName = "@InnerPhone1";
                        prmInnerPhone1.DbType = DbType.String;
                        if (InnerPhone1 == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmInnerPhone1.Value = InnerPhone1;
                        }


                        lstRet = Select(con, "" , " where [InnerPhone1]=@InnerPhone1 ", prmInnerPhone1);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByInnerPhone1(System.String InnerPhone1)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByInnerPhone1(con, InnerPhone1);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByPhone2(ClassDataHandler con,System.String Phone2)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmPhone2 = con.createParameter();
                        prmPhone2.ParameterName = "@Phone2";
                        prmPhone2.DbType = DbType.String;
                        if (Phone2 == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmPhone2.Value = Phone2;
                        }


                        lstRet = Select(con, "" , " where [Phone2]=@Phone2 ", prmPhone2);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByPhone2(System.String Phone2)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByPhone2(con, Phone2);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByInnerPhone2(ClassDataHandler con,System.String InnerPhone2)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmInnerPhone2 = con.createParameter();
                        prmInnerPhone2.ParameterName = "@InnerPhone2";
                        prmInnerPhone2.DbType = DbType.String;
                        if (InnerPhone2 == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmInnerPhone2.Value = InnerPhone2;
                        }


                        lstRet = Select(con, "" , " where [InnerPhone2]=@InnerPhone2 ", prmInnerPhone2);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByInnerPhone2(System.String InnerPhone2)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByInnerPhone2(con, InnerPhone2);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByLanguage(ClassDataHandler con,System.Int64? Language)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmLanguage = con.createParameter();
                        prmLanguage.ParameterName = "@Language";
                        prmLanguage.DbType = DbType.Int64;
                        if (Language == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmLanguage.Value = Language;
                        }


                        lstRet = Select(con, "" , " where [Language]=@Language ", prmLanguage);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByLanguage(System.Int64? Language)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByLanguage(con, Language);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByStatusID(ClassDataHandler con,System.Int64 StatusID)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmStatusID = con.createParameter();
                        prmStatusID.ParameterName = "@StatusID";
                        prmStatusID.DbType = DbType.Int64;
                        if (StatusID == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmStatusID.Value = StatusID;
                        }


                        lstRet = Select(con, "" , " where [StatusID]=@StatusID ", prmStatusID);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByStatusID(System.Int64 StatusID)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByStatusID(con, StatusID);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByExpr1(ClassDataHandler con,System.Int64 Expr1)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmExpr1 = con.createParameter();
                        prmExpr1.ParameterName = "@Expr1";
                        prmExpr1.DbType = DbType.Int64;
                        if (Expr1 == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmExpr1.Value = Expr1;
                        }


                        lstRet = Select(con, "" , " where [Expr1]=@Expr1 ", prmExpr1);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByExpr1(System.Int64 Expr1)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByExpr1(con, Expr1);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByPersonsID(ClassDataHandler con,System.Int64 PersonsID)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmPersonsID = con.createParameter();
                        prmPersonsID.ParameterName = "@PersonsID";
                        prmPersonsID.DbType = DbType.Int64;
                        if (PersonsID == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmPersonsID.Value = PersonsID;
                        }


                        lstRet = Select(con, "" , " where [PersonsID]=@PersonsID ", prmPersonsID);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByPersonsID(System.Int64 PersonsID)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByPersonsID(con, PersonsID);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByRuleID(ClassDataHandler con,System.Int64 RuleID)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmRuleID = con.createParameter();
                        prmRuleID.ParameterName = "@RuleID";
                        prmRuleID.DbType = DbType.Int64;
                        if (RuleID == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmRuleID.Value = RuleID;
                        }


                        lstRet = Select(con, "" , " where [RuleID]=@RuleID ", prmRuleID);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByRuleID(System.Int64 RuleID)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByRuleID(con, RuleID);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByExpr2(ClassDataHandler con,System.Int64 Expr2)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmExpr2 = con.createParameter();
                        prmExpr2.ParameterName = "@Expr2";
                        prmExpr2.DbType = DbType.Int64;
                        if (Expr2 == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmExpr2.Value = Expr2;
                        }


                        lstRet = Select(con, "" , " where [Expr2]=@Expr2 ", prmExpr2);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByExpr2(System.Int64 Expr2)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByExpr2(con, Expr2);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByRuleName(ClassDataHandler con,System.String RuleName)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmRuleName = con.createParameter();
                        prmRuleName.ParameterName = "@RuleName";
                        prmRuleName.DbType = DbType.String;
                        if (RuleName == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmRuleName.Value = RuleName;
                        }


                        lstRet = Select(con, "" , " where [RuleName]=@RuleName ", prmRuleName);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByRuleName(System.String RuleName)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByRuleName(con, RuleName);

                        con.CloseConnection();

                        return lstRet;

                    }



                

                    public List<PersonsRulesView> getPersonsRulesViewByRuleNameEN(ClassDataHandler con,System.String RuleNameEN)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();


                        DbParameter prmRuleNameEN = con.createParameter();
                        prmRuleNameEN.ParameterName = "@RuleNameEN";
                        prmRuleNameEN.DbType = DbType.String;
                        if (RuleNameEN == null)
                        {
                            return lstRet;
                        }
                        else
                        {
                            prmRuleNameEN.Value = RuleNameEN;
                        }


                        lstRet = Select(con, "" , " where [RuleNameEN]=@RuleNameEN ", prmRuleNameEN);



                        return lstRet;

                    }


                    public List<PersonsRulesView> getPersonsRulesViewByRuleNameEN(System.String RuleNameEN)
                    {
                        List<PersonsRulesView> lstRet = new List<PersonsRulesView>();

                        ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);
                        con.OpenConnection();

                        lstRet = getPersonsRulesViewByRuleNameEN(con, RuleNameEN);

                        con.CloseConnection();

                        return lstRet;

                    }



                

            
public List<PersonsRulesView> Search(ClassDataHandler con, PersonsRulesView obj)
        {
            string strWhere = "";
            List<DbParameter> lstParameters = new List<DbParameter>();

            
                    if (obj.GenID != -1)
                    {
                        DbParameter prmGenID = con.createParameter();
                        prmGenID.ParameterName = "@GenID";
                        prmGenID.DbType =DbType.Int64;
                        if (obj.GenID == null)
                        {
                            prmGenID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmGenID.Value = obj.GenID;
                        }
                        strWhere += " [GenID]=@GenID AND ";
                        lstParameters.Add(prmGenID);
                     }



                    

                    if (obj.Name_AR != "")
                    {
                        DbParameter prmName_AR = con.createParameter();
                        prmName_AR.ParameterName = "@Name_AR";
                        prmName_AR.DbType =DbType.String;
                        if (obj.Name_AR == null)
                        {
                            prmName_AR.Value = DBNull.Value;
                        }
                        else
                        {
                            prmName_AR.Value = obj.Name_AR;
                        }
                        strWhere += " [Name_AR]=@Name_AR AND ";
                        lstParameters.Add(prmName_AR);
                     }



                    

                    if (obj.Name_EN != "")
                    {
                        DbParameter prmName_EN = con.createParameter();
                        prmName_EN.ParameterName = "@Name_EN";
                        prmName_EN.DbType =DbType.String;
                        if (obj.Name_EN == null)
                        {
                            prmName_EN.Value = DBNull.Value;
                        }
                        else
                        {
                            prmName_EN.Value = obj.Name_EN;
                        }
                        strWhere += " [Name_EN]=@Name_EN AND ";
                        lstParameters.Add(prmName_EN);
                     }



                    

                    if (obj.MiddleName_AR != "")
                    {
                        DbParameter prmMiddleName_AR = con.createParameter();
                        prmMiddleName_AR.ParameterName = "@MiddleName_AR";
                        prmMiddleName_AR.DbType =DbType.String;
                        if (obj.MiddleName_AR == null)
                        {
                            prmMiddleName_AR.Value = DBNull.Value;
                        }
                        else
                        {
                            prmMiddleName_AR.Value = obj.MiddleName_AR;
                        }
                        strWhere += " [MiddleName_AR]=@MiddleName_AR AND ";
                        lstParameters.Add(prmMiddleName_AR);
                     }



                    

                    if (obj.MiddleName_EN != "")
                    {
                        DbParameter prmMiddleName_EN = con.createParameter();
                        prmMiddleName_EN.ParameterName = "@MiddleName_EN";
                        prmMiddleName_EN.DbType =DbType.String;
                        if (obj.MiddleName_EN == null)
                        {
                            prmMiddleName_EN.Value = DBNull.Value;
                        }
                        else
                        {
                            prmMiddleName_EN.Value = obj.MiddleName_EN;
                        }
                        strWhere += " [MiddleName_EN]=@MiddleName_EN AND ";
                        lstParameters.Add(prmMiddleName_EN);
                     }



                    

                    if (obj.FamilyName_AR != "")
                    {
                        DbParameter prmFamilyName_AR = con.createParameter();
                        prmFamilyName_AR.ParameterName = "@FamilyName_AR";
                        prmFamilyName_AR.DbType =DbType.String;
                        if (obj.FamilyName_AR == null)
                        {
                            prmFamilyName_AR.Value = DBNull.Value;
                        }
                        else
                        {
                            prmFamilyName_AR.Value = obj.FamilyName_AR;
                        }
                        strWhere += " [FamilyName_AR]=@FamilyName_AR AND ";
                        lstParameters.Add(prmFamilyName_AR);
                     }



                    

                    if (obj.FamilyName_EN != "")
                    {
                        DbParameter prmFamilyName_EN = con.createParameter();
                        prmFamilyName_EN.ParameterName = "@FamilyName_EN";
                        prmFamilyName_EN.DbType =DbType.String;
                        if (obj.FamilyName_EN == null)
                        {
                            prmFamilyName_EN.Value = DBNull.Value;
                        }
                        else
                        {
                            prmFamilyName_EN.Value = obj.FamilyName_EN;
                        }
                        strWhere += " [FamilyName_EN]=@FamilyName_EN AND ";
                        lstParameters.Add(prmFamilyName_EN);
                     }



                    

                    if (obj.Gender != false)
                    {
                        DbParameter prmGender = con.createParameter();
                        prmGender.ParameterName = "@Gender";
                        prmGender.DbType =DbType.Boolean;
                        if (obj.Gender == null)
                        {
                            prmGender.Value = DBNull.Value;
                        }
                        else
                        {
                            prmGender.Value = obj.Gender;
                        }
                        strWhere += " [Gender]=@Gender AND ";
                        lstParameters.Add(prmGender);
                     }



                    

                    if (obj.Badge != "")
                    {
                        DbParameter prmBadge = con.createParameter();
                        prmBadge.ParameterName = "@Badge";
                        prmBadge.DbType =DbType.String;
                        if (obj.Badge == null)
                        {
                            prmBadge.Value = DBNull.Value;
                        }
                        else
                        {
                            prmBadge.Value = obj.Badge;
                        }
                        strWhere += " [Badge]=@Badge AND ";
                        lstParameters.Add(prmBadge);
                     }



                    

                    if (obj.ID != "")
                    {
                        DbParameter prmID = con.createParameter();
                        prmID.ParameterName = "@ID";
                        prmID.DbType =DbType.String;
                        if (obj.ID == null)
                        {
                            prmID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmID.Value = obj.ID;
                        }
                        strWhere += " [ID]=@ID AND ";
                        lstParameters.Add(prmID);
                     }



                    

                    if (obj.BirthDate != null)
                    {
                        DbParameter prmBirthDate = con.createParameter();
                        prmBirthDate.ParameterName = "@BirthDate";
                        prmBirthDate.DbType =DbType.DateTime;
                        if (obj.BirthDate == null)
                        {
                            prmBirthDate.Value = DBNull.Value;
                        }
                        else
                        {
                            prmBirthDate.Value = obj.BirthDate;
                        }
                        strWhere += " [BirthDate]=@BirthDate AND ";
                        lstParameters.Add(prmBirthDate);
                     }



                    

                    if (obj.RelationID != null)
                    {
                        DbParameter prmRelationID = con.createParameter();
                        prmRelationID.ParameterName = "@RelationID";
                        prmRelationID.DbType =DbType.Int64;
                        if (obj.RelationID == null)
                        {
                            prmRelationID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmRelationID.Value = obj.RelationID;
                        }
                        strWhere += " [RelationID]=@RelationID AND ";
                        lstParameters.Add(prmRelationID);
                     }



                    

                    if (obj.NationalityID != null)
                    {
                        DbParameter prmNationalityID = con.createParameter();
                        prmNationalityID.ParameterName = "@NationalityID";
                        prmNationalityID.DbType =DbType.Int64;
                        if (obj.NationalityID == null)
                        {
                            prmNationalityID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmNationalityID.Value = obj.NationalityID;
                        }
                        strWhere += " [NationalityID]=@NationalityID AND ";
                        lstParameters.Add(prmNationalityID);
                     }



                    

                    if (obj.OperationAreaID != null)
                    {
                        DbParameter prmOperationAreaID = con.createParameter();
                        prmOperationAreaID.ParameterName = "@OperationAreaID";
                        prmOperationAreaID.DbType =DbType.Int64;
                        if (obj.OperationAreaID == null)
                        {
                            prmOperationAreaID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmOperationAreaID.Value = obj.OperationAreaID;
                        }
                        strWhere += " [OperationAreaID]=@OperationAreaID AND ";
                        lstParameters.Add(prmOperationAreaID);
                     }



                    

                    if (obj.PersonTypeID != null)
                    {
                        DbParameter prmPersonTypeID = con.createParameter();
                        prmPersonTypeID.ParameterName = "@PersonTypeID";
                        prmPersonTypeID.DbType =DbType.Int64;
                        if (obj.PersonTypeID == null)
                        {
                            prmPersonTypeID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmPersonTypeID.Value = obj.PersonTypeID;
                        }
                        strWhere += " [PersonTypeID]=@PersonTypeID AND ";
                        lstParameters.Add(prmPersonTypeID);
                     }



                    

                    if (obj.ChargeAccount != "")
                    {
                        DbParameter prmChargeAccount = con.createParameter();
                        prmChargeAccount.ParameterName = "@ChargeAccount";
                        prmChargeAccount.DbType =DbType.String;
                        if (obj.ChargeAccount == null)
                        {
                            prmChargeAccount.Value = DBNull.Value;
                        }
                        else
                        {
                            prmChargeAccount.Value = obj.ChargeAccount;
                        }
                        strWhere += " [ChargeAccount]=@ChargeAccount AND ";
                        lstParameters.Add(prmChargeAccount);
                     }



                    

                    if (obj.OrgChartID != null)
                    {
                        DbParameter prmOrgChartID = con.createParameter();
                        prmOrgChartID.ParameterName = "@OrgChartID";
                        prmOrgChartID.DbType =DbType.Int64;
                        if (obj.OrgChartID == null)
                        {
                            prmOrgChartID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmOrgChartID.Value = obj.OrgChartID;
                        }
                        strWhere += " [OrgChartID]=@OrgChartID AND ";
                        lstParameters.Add(prmOrgChartID);
                     }



                    

                    if (obj.Email != "")
                    {
                        DbParameter prmEmail = con.createParameter();
                        prmEmail.ParameterName = "@Email";
                        prmEmail.DbType =DbType.String;
                        if (obj.Email == null)
                        {
                            prmEmail.Value = DBNull.Value;
                        }
                        else
                        {
                            prmEmail.Value = obj.Email;
                        }
                        strWhere += " [Email]=@Email AND ";
                        lstParameters.Add(prmEmail);
                     }



                    

                    if (obj.Password != "")
                    {
                        DbParameter prmPassword = con.createParameter();
                        prmPassword.ParameterName = "@Password";
                        prmPassword.DbType =DbType.String;
                        if (obj.Password == null)
                        {
                            prmPassword.Value = DBNull.Value;
                        }
                        else
                        {
                            prmPassword.Value = obj.Password;
                        }
                        strWhere += " [Password]=@Password AND ";
                        lstParameters.Add(prmPassword);
                     }



                    

                    if (obj.UserTypeID != -1)
                    {
                        DbParameter prmUserTypeID = con.createParameter();
                        prmUserTypeID.ParameterName = "@UserTypeID";
                        prmUserTypeID.DbType =DbType.Int64;
                        if (obj.UserTypeID == null)
                        {
                            prmUserTypeID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmUserTypeID.Value = obj.UserTypeID;
                        }
                        strWhere += " [UserTypeID]=@UserTypeID AND ";
                        lstParameters.Add(prmUserTypeID);
                     }



                    

                    if (obj.Mobile1 != "")
                    {
                        DbParameter prmMobile1 = con.createParameter();
                        prmMobile1.ParameterName = "@Mobile1";
                        prmMobile1.DbType =DbType.String;
                        if (obj.Mobile1 == null)
                        {
                            prmMobile1.Value = DBNull.Value;
                        }
                        else
                        {
                            prmMobile1.Value = obj.Mobile1;
                        }
                        strWhere += " [Mobile1]=@Mobile1 AND ";
                        lstParameters.Add(prmMobile1);
                     }



                    

                    if (obj.Mobile2 != "")
                    {
                        DbParameter prmMobile2 = con.createParameter();
                        prmMobile2.ParameterName = "@Mobile2";
                        prmMobile2.DbType =DbType.String;
                        if (obj.Mobile2 == null)
                        {
                            prmMobile2.Value = DBNull.Value;
                        }
                        else
                        {
                            prmMobile2.Value = obj.Mobile2;
                        }
                        strWhere += " [Mobile2]=@Mobile2 AND ";
                        lstParameters.Add(prmMobile2);
                     }



                    

                    if (obj.Phone1 != "")
                    {
                        DbParameter prmPhone1 = con.createParameter();
                        prmPhone1.ParameterName = "@Phone1";
                        prmPhone1.DbType =DbType.String;
                        if (obj.Phone1 == null)
                        {
                            prmPhone1.Value = DBNull.Value;
                        }
                        else
                        {
                            prmPhone1.Value = obj.Phone1;
                        }
                        strWhere += " [Phone1]=@Phone1 AND ";
                        lstParameters.Add(prmPhone1);
                     }



                    

                    if (obj.InnerPhone1 != "")
                    {
                        DbParameter prmInnerPhone1 = con.createParameter();
                        prmInnerPhone1.ParameterName = "@InnerPhone1";
                        prmInnerPhone1.DbType =DbType.String;
                        if (obj.InnerPhone1 == null)
                        {
                            prmInnerPhone1.Value = DBNull.Value;
                        }
                        else
                        {
                            prmInnerPhone1.Value = obj.InnerPhone1;
                        }
                        strWhere += " [InnerPhone1]=@InnerPhone1 AND ";
                        lstParameters.Add(prmInnerPhone1);
                     }



                    

                    if (obj.Phone2 != "")
                    {
                        DbParameter prmPhone2 = con.createParameter();
                        prmPhone2.ParameterName = "@Phone2";
                        prmPhone2.DbType =DbType.String;
                        if (obj.Phone2 == null)
                        {
                            prmPhone2.Value = DBNull.Value;
                        }
                        else
                        {
                            prmPhone2.Value = obj.Phone2;
                        }
                        strWhere += " [Phone2]=@Phone2 AND ";
                        lstParameters.Add(prmPhone2);
                     }



                    

                    if (obj.InnerPhone2 != "")
                    {
                        DbParameter prmInnerPhone2 = con.createParameter();
                        prmInnerPhone2.ParameterName = "@InnerPhone2";
                        prmInnerPhone2.DbType =DbType.String;
                        if (obj.InnerPhone2 == null)
                        {
                            prmInnerPhone2.Value = DBNull.Value;
                        }
                        else
                        {
                            prmInnerPhone2.Value = obj.InnerPhone2;
                        }
                        strWhere += " [InnerPhone2]=@InnerPhone2 AND ";
                        lstParameters.Add(prmInnerPhone2);
                     }



                    

                    if (obj.Language != null)
                    {
                        DbParameter prmLanguage = con.createParameter();
                        prmLanguage.ParameterName = "@Language";
                        prmLanguage.DbType =DbType.Int64;
                        if (obj.Language == null)
                        {
                            prmLanguage.Value = DBNull.Value;
                        }
                        else
                        {
                            prmLanguage.Value = obj.Language;
                        }
                        strWhere += " [Language]=@Language AND ";
                        lstParameters.Add(prmLanguage);
                     }



                    

                    if (obj.StatusID != -1)
                    {
                        DbParameter prmStatusID = con.createParameter();
                        prmStatusID.ParameterName = "@StatusID";
                        prmStatusID.DbType =DbType.Int64;
                        if (obj.StatusID == null)
                        {
                            prmStatusID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmStatusID.Value = obj.StatusID;
                        }
                        strWhere += " [StatusID]=@StatusID AND ";
                        lstParameters.Add(prmStatusID);
                     }



                    

                    if (obj.Expr1 != -1)
                    {
                        DbParameter prmExpr1 = con.createParameter();
                        prmExpr1.ParameterName = "@Expr1";
                        prmExpr1.DbType =DbType.Int64;
                        if (obj.Expr1 == null)
                        {
                            prmExpr1.Value = DBNull.Value;
                        }
                        else
                        {
                            prmExpr1.Value = obj.Expr1;
                        }
                        strWhere += " [Expr1]=@Expr1 AND ";
                        lstParameters.Add(prmExpr1);
                     }



                    

                    if (obj.PersonsID != -1)
                    {
                        DbParameter prmPersonsID = con.createParameter();
                        prmPersonsID.ParameterName = "@PersonsID";
                        prmPersonsID.DbType =DbType.Int64;
                        if (obj.PersonsID == null)
                        {
                            prmPersonsID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmPersonsID.Value = obj.PersonsID;
                        }
                        strWhere += " [PersonsID]=@PersonsID AND ";
                        lstParameters.Add(prmPersonsID);
                     }



                    

                    if (obj.RuleID != -1)
                    {
                        DbParameter prmRuleID = con.createParameter();
                        prmRuleID.ParameterName = "@RuleID";
                        prmRuleID.DbType =DbType.Int64;
                        if (obj.RuleID == null)
                        {
                            prmRuleID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmRuleID.Value = obj.RuleID;
                        }
                        strWhere += " [RuleID]=@RuleID AND ";
                        lstParameters.Add(prmRuleID);
                     }



                    

                    if (obj.Expr2 != -1)
                    {
                        DbParameter prmExpr2 = con.createParameter();
                        prmExpr2.ParameterName = "@Expr2";
                        prmExpr2.DbType =DbType.Int64;
                        if (obj.Expr2 == null)
                        {
                            prmExpr2.Value = DBNull.Value;
                        }
                        else
                        {
                            prmExpr2.Value = obj.Expr2;
                        }
                        strWhere += " [Expr2]=@Expr2 AND ";
                        lstParameters.Add(prmExpr2);
                     }



                    

                    if (obj.RuleName != "")
                    {
                        DbParameter prmRuleName = con.createParameter();
                        prmRuleName.ParameterName = "@RuleName";
                        prmRuleName.DbType =DbType.String;
                        if (obj.RuleName == null)
                        {
                            prmRuleName.Value = DBNull.Value;
                        }
                        else
                        {
                            prmRuleName.Value = obj.RuleName;
                        }
                        strWhere += " [RuleName]=@RuleName AND ";
                        lstParameters.Add(prmRuleName);
                     }



                    

                    if (obj.RuleNameEN != "")
                    {
                        DbParameter prmRuleNameEN = con.createParameter();
                        prmRuleNameEN.ParameterName = "@RuleNameEN";
                        prmRuleNameEN.DbType =DbType.String;
                        if (obj.RuleNameEN == null)
                        {
                            prmRuleNameEN.Value = DBNull.Value;
                        }
                        else
                        {
                            prmRuleNameEN.Value = obj.RuleNameEN;
                        }
                        strWhere += " [RuleNameEN]=@RuleNameEN AND ";
                        lstParameters.Add(prmRuleNameEN);
                     }



                    


            if (strWhere != "")
                        strWhere = " where " + strWhere.Substring(0, strWhere.LastIndexOf("AND"));

                    

            

            List<PersonsRulesView> lstRet = Select(con, "", strWhere, lstParameters.ToArray());

            return lstRet;
        }


        public List<PersonsRulesView> Search(PersonsRulesView obj)
        {
            ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);

            con.OpenConnection();

            List<PersonsRulesView> lstRet = Search(con,obj);

            con.CloseConnection();

            return lstRet;
        }


                

            
public List<PersonsRulesView> SearchOrLike(ClassDataHandler con, PersonsRulesView obj)
        {
            string strWhere = "";
            List<DbParameter> lstParameters = new List<DbParameter>();

            
                    if (obj.GenID != -1)
                    {
                        DbParameter prmGenID = con.createParameter();
                        prmGenID.ParameterName = "@GenID";
                        prmGenID.DbType =DbType.Int64;
                        if (obj.GenID == null)
                        {
                            prmGenID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmGenID.Value = obj.GenID;
                        }
                        strWhere += " [GenID]=@GenID OR ";
                        lstParameters.Add(prmGenID);
                     }



                    

                    if (obj.Name_AR != "")
                    {
                        DbParameter prmName_AR = con.createParameter();
                        prmName_AR.ParameterName = "@Name_AR";
                        prmName_AR.DbType =DbType.String;
                        if (obj.Name_AR == null)
                        {
                            prmName_AR.Value = DBNull.Value;
                        }
                        else
                        {
                            prmName_AR.Value = obj.Name_AR;
                        }
                        strWhere += " [Name_AR] LIKE @Name_AR OR ";
                        lstParameters.Add(prmName_AR);
                     }



                    

                    if (obj.Name_EN != "")
                    {
                        DbParameter prmName_EN = con.createParameter();
                        prmName_EN.ParameterName = "@Name_EN";
                        prmName_EN.DbType =DbType.String;
                        if (obj.Name_EN == null)
                        {
                            prmName_EN.Value = DBNull.Value;
                        }
                        else
                        {
                            prmName_EN.Value = obj.Name_EN;
                        }
                        strWhere += " [Name_EN] LIKE @Name_EN OR ";
                        lstParameters.Add(prmName_EN);
                     }



                    

                    if (obj.MiddleName_AR != "")
                    {
                        DbParameter prmMiddleName_AR = con.createParameter();
                        prmMiddleName_AR.ParameterName = "@MiddleName_AR";
                        prmMiddleName_AR.DbType =DbType.String;
                        if (obj.MiddleName_AR == null)
                        {
                            prmMiddleName_AR.Value = DBNull.Value;
                        }
                        else
                        {
                            prmMiddleName_AR.Value = obj.MiddleName_AR;
                        }
                        strWhere += " [MiddleName_AR] LIKE @MiddleName_AR OR ";
                        lstParameters.Add(prmMiddleName_AR);
                     }



                    

                    if (obj.MiddleName_EN != "")
                    {
                        DbParameter prmMiddleName_EN = con.createParameter();
                        prmMiddleName_EN.ParameterName = "@MiddleName_EN";
                        prmMiddleName_EN.DbType =DbType.String;
                        if (obj.MiddleName_EN == null)
                        {
                            prmMiddleName_EN.Value = DBNull.Value;
                        }
                        else
                        {
                            prmMiddleName_EN.Value = obj.MiddleName_EN;
                        }
                        strWhere += " [MiddleName_EN] LIKE @MiddleName_EN OR ";
                        lstParameters.Add(prmMiddleName_EN);
                     }



                    

                    if (obj.FamilyName_AR != "")
                    {
                        DbParameter prmFamilyName_AR = con.createParameter();
                        prmFamilyName_AR.ParameterName = "@FamilyName_AR";
                        prmFamilyName_AR.DbType =DbType.String;
                        if (obj.FamilyName_AR == null)
                        {
                            prmFamilyName_AR.Value = DBNull.Value;
                        }
                        else
                        {
                            prmFamilyName_AR.Value = obj.FamilyName_AR;
                        }
                        strWhere += " [FamilyName_AR] LIKE @FamilyName_AR OR ";
                        lstParameters.Add(prmFamilyName_AR);
                     }



                    

                    if (obj.FamilyName_EN != "")
                    {
                        DbParameter prmFamilyName_EN = con.createParameter();
                        prmFamilyName_EN.ParameterName = "@FamilyName_EN";
                        prmFamilyName_EN.DbType =DbType.String;
                        if (obj.FamilyName_EN == null)
                        {
                            prmFamilyName_EN.Value = DBNull.Value;
                        }
                        else
                        {
                            prmFamilyName_EN.Value = obj.FamilyName_EN;
                        }
                        strWhere += " [FamilyName_EN] LIKE @FamilyName_EN OR ";
                        lstParameters.Add(prmFamilyName_EN);
                     }



                    

                    if (obj.Gender != false)
                    {
                        DbParameter prmGender = con.createParameter();
                        prmGender.ParameterName = "@Gender";
                        prmGender.DbType =DbType.Boolean;
                        if (obj.Gender == null)
                        {
                            prmGender.Value = DBNull.Value;
                        }
                        else
                        {
                            prmGender.Value = obj.Gender;
                        }
                        strWhere += " [Gender]=@Gender OR ";
                        lstParameters.Add(prmGender);
                     }



                    

                    if (obj.Badge != "")
                    {
                        DbParameter prmBadge = con.createParameter();
                        prmBadge.ParameterName = "@Badge";
                        prmBadge.DbType =DbType.String;
                        if (obj.Badge == null)
                        {
                            prmBadge.Value = DBNull.Value;
                        }
                        else
                        {
                            prmBadge.Value = obj.Badge;
                        }
                        strWhere += " [Badge] LIKE @Badge OR ";
                        lstParameters.Add(prmBadge);
                     }



                    

                    if (obj.ID != "")
                    {
                        DbParameter prmID = con.createParameter();
                        prmID.ParameterName = "@ID";
                        prmID.DbType =DbType.String;
                        if (obj.ID == null)
                        {
                            prmID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmID.Value = obj.ID;
                        }
                        strWhere += " [ID] LIKE @ID OR ";
                        lstParameters.Add(prmID);
                     }



                    

                    if (obj.BirthDate != null)
                    {
                        DbParameter prmBirthDate = con.createParameter();
                        prmBirthDate.ParameterName = "@BirthDate";
                        prmBirthDate.DbType =DbType.DateTime;
                        if (obj.BirthDate == null)
                        {
                            prmBirthDate.Value = DBNull.Value;
                        }
                        else
                        {
                            prmBirthDate.Value = obj.BirthDate;
                        }
                        strWhere += " [BirthDate]=@BirthDate OR ";
                        lstParameters.Add(prmBirthDate);
                     }



                    

                    if (obj.RelationID != null)
                    {
                        DbParameter prmRelationID = con.createParameter();
                        prmRelationID.ParameterName = "@RelationID";
                        prmRelationID.DbType =DbType.Int64;
                        if (obj.RelationID == null)
                        {
                            prmRelationID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmRelationID.Value = obj.RelationID;
                        }
                        strWhere += " [RelationID]=@RelationID OR ";
                        lstParameters.Add(prmRelationID);
                     }



                    

                    if (obj.NationalityID != null)
                    {
                        DbParameter prmNationalityID = con.createParameter();
                        prmNationalityID.ParameterName = "@NationalityID";
                        prmNationalityID.DbType =DbType.Int64;
                        if (obj.NationalityID == null)
                        {
                            prmNationalityID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmNationalityID.Value = obj.NationalityID;
                        }
                        strWhere += " [NationalityID]=@NationalityID OR ";
                        lstParameters.Add(prmNationalityID);
                     }



                    

                    if (obj.OperationAreaID != null)
                    {
                        DbParameter prmOperationAreaID = con.createParameter();
                        prmOperationAreaID.ParameterName = "@OperationAreaID";
                        prmOperationAreaID.DbType =DbType.Int64;
                        if (obj.OperationAreaID == null)
                        {
                            prmOperationAreaID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmOperationAreaID.Value = obj.OperationAreaID;
                        }
                        strWhere += " [OperationAreaID]=@OperationAreaID OR ";
                        lstParameters.Add(prmOperationAreaID);
                     }



                    

                    if (obj.PersonTypeID != null)
                    {
                        DbParameter prmPersonTypeID = con.createParameter();
                        prmPersonTypeID.ParameterName = "@PersonTypeID";
                        prmPersonTypeID.DbType =DbType.Int64;
                        if (obj.PersonTypeID == null)
                        {
                            prmPersonTypeID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmPersonTypeID.Value = obj.PersonTypeID;
                        }
                        strWhere += " [PersonTypeID]=@PersonTypeID OR ";
                        lstParameters.Add(prmPersonTypeID);
                     }



                    

                    if (obj.ChargeAccount != "")
                    {
                        DbParameter prmChargeAccount = con.createParameter();
                        prmChargeAccount.ParameterName = "@ChargeAccount";
                        prmChargeAccount.DbType =DbType.String;
                        if (obj.ChargeAccount == null)
                        {
                            prmChargeAccount.Value = DBNull.Value;
                        }
                        else
                        {
                            prmChargeAccount.Value = obj.ChargeAccount;
                        }
                        strWhere += " [ChargeAccount] LIKE @ChargeAccount OR ";
                        lstParameters.Add(prmChargeAccount);
                     }



                    

                    if (obj.OrgChartID != null)
                    {
                        DbParameter prmOrgChartID = con.createParameter();
                        prmOrgChartID.ParameterName = "@OrgChartID";
                        prmOrgChartID.DbType =DbType.Int64;
                        if (obj.OrgChartID == null)
                        {
                            prmOrgChartID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmOrgChartID.Value = obj.OrgChartID;
                        }
                        strWhere += " [OrgChartID]=@OrgChartID OR ";
                        lstParameters.Add(prmOrgChartID);
                     }



                    

                    if (obj.Email != "")
                    {
                        DbParameter prmEmail = con.createParameter();
                        prmEmail.ParameterName = "@Email";
                        prmEmail.DbType =DbType.String;
                        if (obj.Email == null)
                        {
                            prmEmail.Value = DBNull.Value;
                        }
                        else
                        {
                            prmEmail.Value = obj.Email;
                        }
                        strWhere += " [Email] LIKE @Email OR ";
                        lstParameters.Add(prmEmail);
                     }



                    

                    if (obj.Password != "")
                    {
                        DbParameter prmPassword = con.createParameter();
                        prmPassword.ParameterName = "@Password";
                        prmPassword.DbType =DbType.String;
                        if (obj.Password == null)
                        {
                            prmPassword.Value = DBNull.Value;
                        }
                        else
                        {
                            prmPassword.Value = obj.Password;
                        }
                        strWhere += " [Password] LIKE @Password OR ";
                        lstParameters.Add(prmPassword);
                     }



                    

                    if (obj.UserTypeID != -1)
                    {
                        DbParameter prmUserTypeID = con.createParameter();
                        prmUserTypeID.ParameterName = "@UserTypeID";
                        prmUserTypeID.DbType =DbType.Int64;
                        if (obj.UserTypeID == null)
                        {
                            prmUserTypeID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmUserTypeID.Value = obj.UserTypeID;
                        }
                        strWhere += " [UserTypeID]=@UserTypeID OR ";
                        lstParameters.Add(prmUserTypeID);
                     }



                    

                    if (obj.Mobile1 != "")
                    {
                        DbParameter prmMobile1 = con.createParameter();
                        prmMobile1.ParameterName = "@Mobile1";
                        prmMobile1.DbType =DbType.String;
                        if (obj.Mobile1 == null)
                        {
                            prmMobile1.Value = DBNull.Value;
                        }
                        else
                        {
                            prmMobile1.Value = obj.Mobile1;
                        }
                        strWhere += " [Mobile1] LIKE @Mobile1 OR ";
                        lstParameters.Add(prmMobile1);
                     }



                    

                    if (obj.Mobile2 != "")
                    {
                        DbParameter prmMobile2 = con.createParameter();
                        prmMobile2.ParameterName = "@Mobile2";
                        prmMobile2.DbType =DbType.String;
                        if (obj.Mobile2 == null)
                        {
                            prmMobile2.Value = DBNull.Value;
                        }
                        else
                        {
                            prmMobile2.Value = obj.Mobile2;
                        }
                        strWhere += " [Mobile2] LIKE @Mobile2 OR ";
                        lstParameters.Add(prmMobile2);
                     }



                    

                    if (obj.Phone1 != "")
                    {
                        DbParameter prmPhone1 = con.createParameter();
                        prmPhone1.ParameterName = "@Phone1";
                        prmPhone1.DbType =DbType.String;
                        if (obj.Phone1 == null)
                        {
                            prmPhone1.Value = DBNull.Value;
                        }
                        else
                        {
                            prmPhone1.Value = obj.Phone1;
                        }
                        strWhere += " [Phone1] LIKE @Phone1 OR ";
                        lstParameters.Add(prmPhone1);
                     }



                    

                    if (obj.InnerPhone1 != "")
                    {
                        DbParameter prmInnerPhone1 = con.createParameter();
                        prmInnerPhone1.ParameterName = "@InnerPhone1";
                        prmInnerPhone1.DbType =DbType.String;
                        if (obj.InnerPhone1 == null)
                        {
                            prmInnerPhone1.Value = DBNull.Value;
                        }
                        else
                        {
                            prmInnerPhone1.Value = obj.InnerPhone1;
                        }
                        strWhere += " [InnerPhone1] LIKE @InnerPhone1 OR ";
                        lstParameters.Add(prmInnerPhone1);
                     }



                    

                    if (obj.Phone2 != "")
                    {
                        DbParameter prmPhone2 = con.createParameter();
                        prmPhone2.ParameterName = "@Phone2";
                        prmPhone2.DbType =DbType.String;
                        if (obj.Phone2 == null)
                        {
                            prmPhone2.Value = DBNull.Value;
                        }
                        else
                        {
                            prmPhone2.Value = obj.Phone2;
                        }
                        strWhere += " [Phone2] LIKE @Phone2 OR ";
                        lstParameters.Add(prmPhone2);
                     }



                    

                    if (obj.InnerPhone2 != "")
                    {
                        DbParameter prmInnerPhone2 = con.createParameter();
                        prmInnerPhone2.ParameterName = "@InnerPhone2";
                        prmInnerPhone2.DbType =DbType.String;
                        if (obj.InnerPhone2 == null)
                        {
                            prmInnerPhone2.Value = DBNull.Value;
                        }
                        else
                        {
                            prmInnerPhone2.Value = obj.InnerPhone2;
                        }
                        strWhere += " [InnerPhone2] LIKE @InnerPhone2 OR ";
                        lstParameters.Add(prmInnerPhone2);
                     }



                    

                    if (obj.Language != null)
                    {
                        DbParameter prmLanguage = con.createParameter();
                        prmLanguage.ParameterName = "@Language";
                        prmLanguage.DbType =DbType.Int64;
                        if (obj.Language == null)
                        {
                            prmLanguage.Value = DBNull.Value;
                        }
                        else
                        {
                            prmLanguage.Value = obj.Language;
                        }
                        strWhere += " [Language]=@Language OR ";
                        lstParameters.Add(prmLanguage);
                     }



                    

                    if (obj.StatusID != -1)
                    {
                        DbParameter prmStatusID = con.createParameter();
                        prmStatusID.ParameterName = "@StatusID";
                        prmStatusID.DbType =DbType.Int64;
                        if (obj.StatusID == null)
                        {
                            prmStatusID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmStatusID.Value = obj.StatusID;
                        }
                        strWhere += " [StatusID]=@StatusID OR ";
                        lstParameters.Add(prmStatusID);
                     }



                    

                    if (obj.Expr1 != -1)
                    {
                        DbParameter prmExpr1 = con.createParameter();
                        prmExpr1.ParameterName = "@Expr1";
                        prmExpr1.DbType =DbType.Int64;
                        if (obj.Expr1 == null)
                        {
                            prmExpr1.Value = DBNull.Value;
                        }
                        else
                        {
                            prmExpr1.Value = obj.Expr1;
                        }
                        strWhere += " [Expr1]=@Expr1 OR ";
                        lstParameters.Add(prmExpr1);
                     }



                    

                    if (obj.PersonsID != -1)
                    {
                        DbParameter prmPersonsID = con.createParameter();
                        prmPersonsID.ParameterName = "@PersonsID";
                        prmPersonsID.DbType =DbType.Int64;
                        if (obj.PersonsID == null)
                        {
                            prmPersonsID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmPersonsID.Value = obj.PersonsID;
                        }
                        strWhere += " [PersonsID]=@PersonsID OR ";
                        lstParameters.Add(prmPersonsID);
                     }



                    

                    if (obj.RuleID != -1)
                    {
                        DbParameter prmRuleID = con.createParameter();
                        prmRuleID.ParameterName = "@RuleID";
                        prmRuleID.DbType =DbType.Int64;
                        if (obj.RuleID == null)
                        {
                            prmRuleID.Value = DBNull.Value;
                        }
                        else
                        {
                            prmRuleID.Value = obj.RuleID;
                        }
                        strWhere += " [RuleID]=@RuleID OR ";
                        lstParameters.Add(prmRuleID);
                     }



                    

                    if (obj.Expr2 != -1)
                    {
                        DbParameter prmExpr2 = con.createParameter();
                        prmExpr2.ParameterName = "@Expr2";
                        prmExpr2.DbType =DbType.Int64;
                        if (obj.Expr2 == null)
                        {
                            prmExpr2.Value = DBNull.Value;
                        }
                        else
                        {
                            prmExpr2.Value = obj.Expr2;
                        }
                        strWhere += " [Expr2]=@Expr2 OR ";
                        lstParameters.Add(prmExpr2);
                     }



                    

                    if (obj.RuleName != "")
                    {
                        DbParameter prmRuleName = con.createParameter();
                        prmRuleName.ParameterName = "@RuleName";
                        prmRuleName.DbType =DbType.String;
                        if (obj.RuleName == null)
                        {
                            prmRuleName.Value = DBNull.Value;
                        }
                        else
                        {
                            prmRuleName.Value = obj.RuleName;
                        }
                        strWhere += " [RuleName] LIKE @RuleName OR ";
                        lstParameters.Add(prmRuleName);
                     }



                    

                    if (obj.RuleNameEN != "")
                    {
                        DbParameter prmRuleNameEN = con.createParameter();
                        prmRuleNameEN.ParameterName = "@RuleNameEN";
                        prmRuleNameEN.DbType =DbType.String;
                        if (obj.RuleNameEN == null)
                        {
                            prmRuleNameEN.Value = DBNull.Value;
                        }
                        else
                        {
                            prmRuleNameEN.Value = obj.RuleNameEN;
                        }
                        strWhere += " [RuleNameEN] LIKE @RuleNameEN OR ";
                        lstParameters.Add(prmRuleNameEN);
                     }



                    


            if (strWhere != "")
                        strWhere = " where " + strWhere.Substring(0, strWhere.LastIndexOf("OR"));

                    

            

            List<PersonsRulesView> lstRet = Select(con, "", strWhere, lstParameters.ToArray());

            return lstRet;
        }


        public List<PersonsRulesView> SearchOrLike(PersonsRulesView obj)
        {
            ClassDataHandler con = new ClassDataHandler(_Connection, _Provider);

            con.OpenConnection();

            List<PersonsRulesView> lstRet = SearchOrLike(con,obj);

            con.CloseConnection();

            return lstRet;
        }


                
        


       
        



    }
}











            